package com.czmh.etc.onlinepubsys.feign.newrun;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.czmh.etc.onlinepubsys.dto.EtcYueSaveApplyReqDTO;
import com.czmh.etc.onlinepubsys.feign.newrun.constans.NewrunConstants;
import com.czmh.etc.onlinepubsys.feign.newrun.entity.yue.EtcYueBankCardInfo;
import com.czmh.etc.onlinepubsys.feign.newrun.entity.yue.EtcYueShippingInfo;
import com.czmh.etc.onlinepubsys.json.JsonResult;

/**
 * @ClassName：YueClient
 * @Description：粤通卡开发服务
 * @Author： sevenchen.
 * @Date：2019/10/16 16:29.
 * @Version：1.0.0
 */
@FeignClient(name = "YueClient",
        url = NewrunConstants.FETCH_DOMAIN + "/api/yue/",
        fallback = YueClient.DefaultFallback.class
)
public interface YueClient {
    /**
     * 保存申请信息
     *
     * @param saveApplyReqDTO
     * @return
     */
    @PostMapping(value = "saveApplyInfo")
    JsonResult saveApplyInfo(@RequestBody EtcYueSaveApplyReqDTO saveApplyReqDTO);

    /**
     * 根据证件号查询签约方式
     * @param certNo 不可为空! 身份证号
     * @return
     */
    @GetMapping(value = "querySignType")
    JsonResult querySignType(@RequestParam("certNo") String certNo);

    /**
     * 查询车辆是否已办理粤通卡
     * @param mblNo 可为空! 手机号码
     * @param plateColor 不可为空! 车牌颜色: 0-蓝. 4-绿色.
     * @param plateNo 不可为空! 车牌号码
     * @return
     */
    @GetMapping(value = "queryIssue")
    JsonResult queryIssue(@RequestParam(name = "mblNo", required = false) String mblNo,
                          @RequestParam("plateColor") String plateColor,
                          @RequestParam("plateNo") String plateNo);

//    批量的方式, 到时候看看是否需要, 如果需要的话, 再了解他们的excel格式是如何的, 是否只有两个列
//    JsonResult queryIssueBath()

    /**
     * 添加收货信息
     *
     * @param shippingInfo
     * @return
     */
    @PostMapping(value = "addShippingInfo")
    JsonResult addShippingInfo(@RequestBody EtcYueShippingInfo shippingInfo);
    
    /**
     * 单笔订单查询
     *
     * @param niurunApplyId          纽润接口的申请id
     * @return
     */
    @GetMapping(value = "checkOrder")
    JsonResult checkOrder(@RequestParam("applyId") String niurunApplyId);
    
    /**
     * 绑定银行卡
     * @param bankCardInfo     银行卡信息
     * @return
     */
    @PostMapping(value = "bindAccount")
    JsonResult bindAccount(EtcYueBankCardInfo bankCardInfo);

    public class DefaultFallback implements YueClient {
        @Override
        public JsonResult saveApplyInfo(@RequestBody EtcYueSaveApplyReqDTO saveApplyReqDTO) {
            return null;
        }

        @Override
        public JsonResult querySignType(@RequestParam("certNo") String certNo) {
            return null;
        }

        @Override
        public JsonResult queryIssue(@RequestParam("mblNo") String mblNo, @RequestParam("plateColor") String plateColor, @RequestParam("plateNo") String plateNo) {
            return null;
        }

        @Override
        public JsonResult addShippingInfo(@RequestBody EtcYueShippingInfo shippingInfo) {
            return null;
        }

        @Override
        public JsonResult bindAccount(EtcYueBankCardInfo bankCardInfo) {
            return null;
        }

        @Override
        public JsonResult checkOrder(String niurunApplyId) {
            return null;
        }
    }
}
